package com.example.demo.serivce;

import com.alibaba.fastjson.JSONObject;
import com.example.demo.serivce.Impl.IndexService;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Service
public class IndexServiceImp implements IndexService {
    @Resource
    RestTemplate restTemplate;
    @Override
    public void getUri() {
        String  url = "http://10.70.100.56/aiApi/lbs/region/571F01/seg/D/trend?beg_time=20221108&end_time=20221208&app_key=dbe27f96de8b2cb72af3a3d1312e364e";
        JSONObject jsonObject = restTemplate.getForObject(url, JSONObject.class);
        System.out.println(jsonObject);
    }

    public static void main(String[] args) {
        Double sum = 127.0;
        String s = String.valueOf(sum).substring(0,String.valueOf(sum).lastIndexOf("."));
        BigDecimal bd = new BigDecimal(String.valueOf(sum));
        String res = bd.stripTrailingZeros().toPlainString();
        System.out.println(res);
    }
}
